
import UIKit
import Network

@MainActor
class FFCityRoadNetwork: NSObject {
    
    static let net = FFCityRoadNetwork()
    
    private let heist: NWPathMonitor
    
    private(set) var isbox: Bool = false
    
    var mission: ((Bool) -> Void)?
    
    override init() {
        
        heist = NWPathMonitor()
        super.init()
        
        let tmp = DispatchQueue(label: "FFCityRoadNetwork")
        heist.start(queue: tmp)
        heist.pathUpdateHandler = { [weak self] path in
            Task { @MainActor in
                if let mission = self?.mission {
                    mission(path.status == .satisfied)
                }
            }
        }
    }
}
